Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setting up ESLint #110

Merged
merged 19 commits into from
Jul 22, 2020
Merged

Setting up ESLint #110

merged 19 commits into from
Jul 22, 2020

Conversation

rezakrimi
Copy link
Contributor

@rezakrimi rezakrimi commented Jun 25, 2020

Which problem is this PR solving?

Short description of the changes

  • Removing TSLint
  • Setting up ESLint similar to the core repo
    - None of the files are modified by the linter to keep the PR small

@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Jun 25, 2020

CLA Check
The committers are authorized under a signed CLA.

@codecov
Copy link

codecov bot commented Jun 25, 2020

Codecov Report

Merging #110 into master will decrease coverage by 0.45%.
The diff coverage is 82.60%.

@@            Coverage Diff             @@
##           master     #110      +/-   ##
==========================================
- Coverage   94.52%   94.06%   -0.46%     
==========================================
  Files          62       74      +12     
  Lines        3522     3536      +14     
  Branches      372      374       +2     
==========================================
- Hits         3329     3326       -3     
- Misses        193      210      +17     
Impacted Files Coverage Δ
...ins/node/opentelemetry-plugin-pg-pool/.eslintrc.js 0.00% <0.00%> (ø)
...ins/node/opentelemetry-plugin-pg-pool/src/enums.ts 100.00% <ø> (ø)
...s/node/opentelemetry-plugin-pg-pool/src/pg-pool.ts 89.13% <ø> (ø)
...ins/node/opentelemetry-plugin-pg-pool/src/utils.ts 93.33% <ø> (ø)
...s/node/opentelemetry-plugin-pg-pool/src/version.ts 100.00% <ø> (ø)
plugins/node/opentelemetry-plugin-pg/.eslintrc.js 0.00% <0.00%> (ø)
plugins/node/opentelemetry-plugin-pg/src/enums.ts 100.00% <ø> (ø)
plugins/node/opentelemetry-plugin-pg/src/pg.ts 91.37% <ø> (ø)
plugins/node/opentelemetry-plugin-pg/src/utils.ts 96.96% <ø> (ø)
...lugins/node/opentelemetry-plugin-pg/src/version.ts 100.00% <ø> (ø)
... and 34 more

@rezakrimi rezakrimi changed the title Lint Setting up ESLint Jun 25, 2020
@rezakrimi
Copy link
Contributor Author

I think the lint check should install ESLint modules (parser, plugins, etc.) instead of TSLint.

@dyladan
Copy link
Member

dyladan commented Jun 25, 2020

I would look at the github action in the core repo. It may help you get this figured out, and it would be easier to maintain if both repos used the same mechanism.

@obecny
Copy link
Member

obecny commented Jul 1, 2020

@rezakrimi can you please make sure the build actually passes ?

@rezakrimi
Copy link
Contributor Author

@rezakrimi can you please make sure the build actually passes ?

I'm planning to update the lint checks over the weekend. However, some of the files have linting issues that are not fixable by the linter, so the check will still fail. How are we going to work around that? Do you think that fixing lint issues should be a separate issue or should it be part of this PR?

@dyladan
Copy link
Member

dyladan commented Jul 2, 2020

Fixing lint issues should be a part of this PR if it is not too many errors. If it is a large number of errors it may be done in a follow up, but the follow up should be done quickly.

@rezakrimi
Copy link
Contributor Author

rezakrimi commented Jul 5, 2020

Should I make a new PR to trigger github actions?
Also, there's a long list of linting issues and I think they should be fixed in a follow up issue.

"header"
],
extends: [
"./node_modules/gts",
Copy link
Member

@markwolff markwolff Jul 8, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if we could extend the eslint config from the main repo so that changes are automatically picked up after a main repo release? wdyt @dyladan? (Not in scope for this PR though!)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if there is a way to depend on the file directly in github instead of a release. Very interesting idea though. A package like @opentelemetry/eslint-config would be a welcome addition I think.

Copy link
Member

@markwolff markwolff Jul 8, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes we could do something like npm install --save-dev https://github.com/opentelemetry-js/opentelemetry-js/tarball/master, or just the normal cloning url

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dyladan maybe we can create some general package that can be easily shared between contrib repo and here andd maybe even a 3rd party contrib. We could put there a bit more stuff, eslint, karma config, etc. basically all things that could be shared. WDYT ?

.github/workflows/lint.yml Outdated Show resolved Hide resolved
@rezakrimi rezakrimi requested a review from a team July 10, 2020 15:41
@rezakrimi rezakrimi closed this Jul 10, 2020
@rezakrimi rezakrimi reopened this Jul 10, 2020
@rezakrimi rezakrimi closed this Jul 10, 2020
@rezakrimi rezakrimi reopened this Jul 10, 2020
@rezakrimi
Copy link
Contributor Author

As mentioned here: "When you create a pull request from a forked repository to the base repository, GitHub sends the pull_request event to the base repository and no pull request events occur on the forked repository."
So I think because the workflow doesn't exist in the base repository, the new github workflow isn't triggered. I tries closing and reopening this PR but it didn't help.
You can check the new lint workflow running on my branch.
I'll will move on to fixing the linting issues if that looks good.

@rezakrimi
Copy link
Contributor Author

Here is a list of all the linting issues that are not fixable by the linter. Please have a look and comment on how these should be resolved.

Copy link
Member

@obecny obecny left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

packages/opentelemetry-test-utils/testUtils.ts Outdated Show resolved Hide resolved
@rezakrimi rezakrimi marked this pull request as draft July 13, 2020 23:34
@rezakrimi
Copy link
Contributor Author

@OlivierAlbertini Since you're the author of the DNS plugin, could you please help on resolving the issue mentioned here for that plugin?

@dyladan
Copy link
Member

dyladan commented Jul 15, 2020

@rezakrimi can you update the doc to make it clear which issues you have resolved and which you have not?

@rezakrimi
Copy link
Contributor Author

@rezakrimi can you update the doc to make it clear which issues you have resolved and which you have not?

I did, it's on the header for each package

message: error!.message,
},
});
if (semver.lt(process.versions.node, '9.0.0')) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I created a new dns lookup method in this file that is compatible with node 8. The only thing is that the node INVALID_ARGUMENT code seemed to be different in node 8 so I had to make separate cases for this test. If this is fine then I'll open this PR to be merged.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any idea why the canonical code is different between them? I would rather have behavior consistent across versions if possible

Copy link
Contributor Author

@rezakrimi rezakrimi Jul 20, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

based on this it seems like it's possible to have different error codes in different major releases. The error message was the same though.

@rezakrimi rezakrimi marked this pull request as ready for review July 16, 2020 15:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants